ABC 318 C - Blue Spring
提出
code: python
n, d, p = map(int, input().split())
f = list(map(int, input().split()))
f.sort(reverse=True)
ans = 0
while len(f) >= d:
tmp = 0
for _ in range(d):
tmp += f.pop(0)
if tmp > p:
ans += p
else:
ans += tmp
break
print(ans, f)
解答
code: python
n, d, p = map(int, input().split())
f = list(map(int, input().split()))
f.sort(reverse=True)
for left in range(0, n, d):
right = min(left + d, n)
if cost > p:
for i in range(left, right):
else:
break
# print(f)
ans = sum(f)
print(ans)
メモ